<script type="text/javascript">
	$(function(){
		//初始化页面
		load();
		
		$("#com_updet").click(function(){
			$(".com_t").removeAttr("readOnly");
		});
		$("#com_updet1").click(function(){
			$(".com_t").attr("readOnly","true");
			change();
		});
		
	});
	//表单提交
	function change() {   
		 var form = document.forms.namedItem("comform");//表单name属性值
		var formData = new FormData(form);
	    $.ajax({
	        async : true,
	        cache : false,
	        type : "post",
	        data : formData,
	        url : 'changeCompny',
	        dataType : 'json',
	        contentType: false, //必须
			processData: false, //必须
			success : function(data) {
				alert("修改成功");
	        }
	    });
	    load();
	}

	
	
	//定义函数区
	function load(){
		$.post("cominf",{},function(data){
			$("#com_name").attr("placeholder",data.name);
			$("#com_js").attr("placeholder",data.intro);
			$("#com_phone").attr("placeholder",data.phone);
		});
	}
</script>
<div class="cominf">
	<h3>公司信息</h3>
	<div class="com">
		<form name="comform" enctype="multipart/form-data" method="post">
			<div class="form-group">
				<label for="exampleInputEmail1">公司名</label> <input type="text"
					class="form-control com_t" id="com_name" name="name"
					placeholder="黔游公司" readonly />
			</div>
			<div class="form-group">
				<label for="exampleInputEmail1">公司介绍</label>
				<textarea class="form-control com_t" id="com_js" name="js"
					placeholder="公司介绍" readonly></textarea>
			</div>
			<div class="form-group">
				<label for="exampleInputEmail1">联系电话</label> <input type="text"
					class="form-control com_t" id="com_phone" name="phone"
					placeholder="18085078593" readonly />
			</div>
			<div class="form-group">
				<label for="exampleInputFile">图片</label> <input type="file" id="img"
					name="com_img">
				<p class="help-block">请选择你要上传的图片</p>
			</div>
			<button type="button" class="btn btn-success" id="com_updet">修改</button>
			<button type="submit" class="btn btn-success" id="com_updet1">保存</button>
		</form>
	</div>
</div>